﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DAL;

namespace EDMS.Admin.Notice
{
    public partial class AddNotice : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnOK_Click(object sender, EventArgs e)
        {
            insertNotice();
        }

        protected void btnEsc_Click(object sender, EventArgs e)
        {
            txtGgbt.Text = "";
            txtFbr.Text = "";
            txtGgnr.Text = "";
            CmbBj.Text = "";
            deFbsj.Text = "";
        }
        //插入公告
        void insertNotice()
        {
            using (DataClassesDataContext dc = new DataClassesDataContext())
            {
                Xjgg gg = new Xjgg();
                gg.ggbt = txtGgbt.Text;
                gg.nr = txtGgnr.Text;
                gg.fbr = txtFbr.Text;
                gg.fbsj = Convert.ToDateTime(deFbsj.Text);
                gg.flag = CmbBj.Value.ToString();
                dc.Xjgg.InsertOnSubmit(gg);
                dc.SubmitChanges();
                Frame.Global.GlobalFunctions.Alert("选举公告添加成功！");
            }
        }
    }
}